<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <script src="../js/vue.js"></script>
    <script src="../js/echarts.js"></script>
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <script src="../js/axios-0.18.0.js"></script>

    <!-- 引入样式 -->
    <link rel="stylesheet" href="../css/style.css">
    <script src="../plugins/elementui/index.js"></script>
    <script src="../js/jquery.min.js"></script>
    <!--引入ElementUI样式 -->

</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>统计分析<small>会员统计</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>统计分析</el-breadcrumb-item>
            <el-breadcrumb-item>会员统计</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
</div>
<div class="app-container">
<div class="box">
<div id="chart1" style="height:600px;"></div>
</div>
</div>
<script>

    var myChart1 = echarts.init(document.getElementById('chart1'));
    new Vue({
        el: '#app',
        created: function (){
                axios.get("/report/getMemberAgeReport.do").then((res)=>{
                    var map = res.data.data;
                    var a = 0;
                    $.each(map,function (i,val) {
                        a+=val.value;
                    });
                    myChart1.setOption(
                        {
                            title : {
                                text: '会员年龄统计',
                                subtext: '共有'+a+'名会员',
                                x:'center'
                            },
                            tooltip : {
                                trigger: 'item',
                                formatter: "{a} <br/>{b} : {c} ({d}%)"
                            },
                            legend: {
                                orient: 'vertical',
                                x: 'left',
                                data:res.data.data.name,
                            },
                            series : [
                                {
                                    name: '套餐名称',
                                    type: 'pie',
                                    radius : '55%',
                                    center: ['40%', '50%'],
                                    data:res.data.data,
                                    itemStyle: {
                                        emphasis: {
                                            shadowBlur: 10,
                                            shadowOffsetX: 0,
                                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                                        }
                                    }
                                }
                            ]
                        });
                });
            }
    })
</script>
</body>
</html>